package com.example.oauth2.repository;


import com.example.oauth2.entry.AccessToken;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface AccessTokenRepository extends JpaRepository<AccessToken, String> {
    AccessToken findOAuthAccessTokenByTokenId(String tokenId);
    AccessToken findOAuthAccessTokenByAuthenticationId(String authenticationid);
    List<AccessToken> findAll();
    List<AccessToken> findAllByClientIdAndUsername(String clientId, String username);
    List<AccessToken> findAllByClientId(String clientId);
    @Transactional
    void deleteAllByTokenId(String tokenId);
    @Transactional
    void deleteAllByRefreshToken(String refreshToken);
}
